<template>
	<view class="content">
		
		  <button class="disd">
			  <image class="location-icon" src="../../static/Location-icon.png"></image>
			  <text class="location-nane">{{shopName}}</text>
			 
			  <text class="right">{{shopPhone}}</text>
		  </button>
		  <min-action-sheet ref="asshop"></min-action-sheet>
		
		<button v-if='reserve_id==0' @click="fromAs">
		   <image class="location-icon" src="../../static/serviceItemcard.png"></image>
		   <text>预约类型</text>
		   <text class="right">{{from_text}}<text class="right yticon icon-you"></text></text>
		</button>
		<button v-if='reserve_id>0' class="disd">
		   <image class="location-icon" src="../../static/serviceItemcard.png"></image>
		   <text>预约类型</text>
		   <text class="right">{{from_text}}<text class="right yticon icon-you"></text></text>
		</button>
		<min-action-sheet ref="as3"></min-action-sheet>
		<view class="userbox" v-if="reserve_method==''">
			<image class="location-icon" src="../../static/serviceItemcard.png"></image>
			<label class="van-cell_title">用户姓名:</label>
			<div class="van-cell_value">
				<input type="text" maxlength="200" v-model="userName" class="van-field_control"></div>
			</div>
		</view>
		<view class="userbox" v-if="reserve_method==''">
			<image class="location-icon" src="../../static/serviceItemcard.png"></image>
			<label class="van-cell_title">用户手机号:</label>
			<div class="van-cell_value">
				<input type="text" maxlength="200" v-model="userPhone" class="van-field_control"></div>
			</div>
		</view>
		<view class="userbox"  v-if="reserve_method==''">
			<image class="location-icon" src="../../static/serviceItemcard.png"></image>
			<label class="van-cell_title">预约位数:</label>
			<div class="van-cell_value">
				<input type="number" maxlength="200" v-model="userCount" class="van-field_control"></div>
			</div>
		</view>
		<button v-if='reserve_id==0' @click="cardAs">
		   <image class="location-icon" src="../../static/serviceItemcard.png"></image>
		   <text>活动名称</text>
		   <text class="right">{{card_text}}<text class="right yticon icon-you"></text></text>
		</button>
		<button v-if='reserve_id>0'  class="disd">
		   <image class="location-icon" src="../../static/serviceItemcard.png"></image>
		   <text>活动名称</text>
		   <text class="right">{{card_text}}<text class="right yticon icon-you"></text></text>
		</button>
		<min-action-sheet ref="as2"></min-action-sheet>
		<button v-if="reserve_method==''">
		    <image class="location-icon" src="../../static/serviceitem.png"></image>
			<text>服务项目</text>  
		</button>
		<view class="servicebox"  v-if="reserve_method==''">
			<view class="serviceboxline2" v-for="(item,index) in service_list" v-if="service_list.length>0">
				<text class="s_hour" @click="selectService(item)" v-if="!in_array(item.id,yy_serviceIds)" >{{item.title}}</text>
				<text class="s_hour selected" @click="selectService(item)" v-if="in_array(item.id,yy_serviceIds)">{{item.title}}</text>
			</view>		  
			<text class="no-data" v-if="service_list.length==0">暂无服务项目，请选择卡项</text>
		</view>
		<min-action-sheet ref="as"></min-action-sheet>
		<button  @click="adviserAs">
		    <image class="location-icon" src="../../static/consultant.png"></image>
			<text>美容师</text>
		    <text class="right">{{adv_text}}<text class="yticon icon-you"></text></text>
		</button>
		<min-action-sheet ref="as1"></min-action-sheet>
		<button class="tab" :class="[{'active':index==tabIndex}]" @tap="toggleTab(index)" v-for="(item,index) in tabList" :key="index"  v-if="reserve_method==''">
			<image class="location-icon" src="../../static/yuyue_date.png"></image>
		{{item.name}}
		<text class="right">{{yy_serviceDate}}<text class="yticon icon-you"></text></text>
		</button>
		<w-picker 
			:mode="mode" 
			startYear="2019" 
			endYear="2030" 
			step="1" 
			:defaultVal="defaultVal" 
			:current="true" 
			@confirm="onConfirm" 
			ref="picker" 
			themeColor="#f00"
			:selectList="selectList"  v-if="reserve_method==''"
		></w-picker>
		<button  v-if="reserve_method==''">
		    <image class="location-icon" src="../../static/appointdate.png"></image>
			<text>服务时间</text>  
		</button>
		<view class="servicebox"  v-if="reserve_method==''">
			<view class="serviceboxline" v-for="(item,index) in service_hour_list" v-if="service_hour_list.length>has_hours.length">
				<text @click="selectHour(item.name)" class="s_hour disabled" v-if="in_array(item.name,has_hours)">{{item.name}} </text>
				<text class="s_hour" @click="selectHour(item.name)" v-if="!in_array(item.name,has_hours) && !in_array(item.name,yy_serviceHours)" >{{item.name}} </text>
				<text class="s_hour selected" @click="selectHour(item.name)" v-if="!in_array(item.name,has_hours) && in_array(item.name,yy_serviceHours)" >{{item.name}} </text>
			</view>
			<text class="no-data"  v-if="service_hour_list.length<=has_hours.length && service_hour_list.length>0">该美容师当天已被全部预约，请选择其它美容师或其它日期</text>
		</view>	
		<button class="appointment" @click="addReserve()"  v-if="reserve_method==''">预约</button> 
		<button class="appointment" @click="addMemberReserve()" v-if="reserve_method=='' && reserve_id==0 " >预约用户</button>
		<button class="appointment" @click="addReserveLink(1)" v-if="reserve_method!=''">预约连接</button>
		<button class="appointment" @click="addReserveLink(2)" v-if="reserve_method!=''">预约二维码</button>
		<div class="qr-code" v-if='type==2 && reserve_link!=""'>
			<tki-qrcode v-if="ifShow" ref="qrcode" :val="reserve_link" :size="size" :unit="unit" :background="background" :foreground="foreground" :pdground="pdground" :icon="icon" :iconSize="iconsize" :lv="lv" :onval="onval" :loadMake="loadMake" :usingComponents="true" /> 
		</div>
		<div class="qr-code" v-if='type==1 && reserve_link!=""'>
			<button class="appointment" @click="coplink()" >复制链接1</button> 
		</div>
	<!-- popup -->
		<popup :open="openPopup" :position="position" :percent="percent" :background="background" :hide_close="hide_close" @close="close">
		    <view style="text-align: center;" >
		      <view v-if='type==0'>{{reserve_msg}}</view>
			  
		    </view>
		</popup>
		
	</view>
</template>

<script>
	import minActionSheet from '@/components/min-action-sheet/min-action-sheet.vue'
    import popup from '@/components/YYT-popup/YYT-popup.vue';
	import tkiQrcode from "@/components/tki-qrcode/tki-qrcode.vue"
	import wPicker from "@/components/w-picker/w-picker.vue";
	import jweixin from '@/common/wxjdk.js'
	export default {
		components:{
			wPicker,
			popup,
			tkiQrcode,
			jweixin,
			minActionSheet
		},props: {
			card_list: {
				type: Array
			},
			shop_user_list: {
				type: Array
			},
			reserve_id: {
				type: [Number,String]
			},
			reserve_method: {
				type: String
			},
		},
		data() {
			return {
				title: 'ami',
				tabList:[{
					mode:"date",
					name:"预约日期",
					value:[1,1,1,1]
				}],
				selectList:[{
					label:"男",
					value:0
				},{
					label:"女",
					value:1
				}],
				tabIndex:0,
				//pop start
				hide_close:false,
				openPopup: false,
				position: '',
				openAdPopup: false,
				percent: 0,
				showText: false,
				change: false,
				loopTimer: false,
				//pop end
				service_hour_list:[],
				service_hour_list_old:[{"id":8,"name":"08:00-08:59"},
				{"id":9,"name":"09:00-09:59"},
				{"id":10,"name":"10:00-10:59"},
				{"id":11,"name":"11:00-11:59"},
				{"id":13,"name":"13:00-13:59"},
				{"id":14,"name":"14:00-14:59"},
				{"id":15,"name":"15:00-15:59"},
				{"id":16,"name":"16:00-16:59"},
				{"id":17,"name":"17:00-17:59"},
				{"id":18,"name":"18:00-18:59"},
				{"id":19,"name":"19:00-19:59"}],
				need_time:0,
				use_time:0,
				Number:'',
				sizeSort: 'asc',
				adv_text:uni.getStorageSync('admin_name'),
				card_text:"未选择",
				ser_text:'未选择',
				from_text:'未选择',
				from_list:['门店活动','三方活动'],
				service_list:[],
				has_hours:[],
				shopId:0,
				shopName:"",
				shopPhone:"",
				all_has_hours:[],
				yy_serviceIds:[],
				yy_serviceTitles:[],
				yy_cardId:'',
				yy_cardName:'',
				yy_shopUserId:uni.getStorageSync('admin_id'),
				yy_shopUserName:uni.getStorageSync('admin_name'),
				yy_serviceDate:"",
				yy_serviceHours:[],
				userName:"",
				userPhone:"",
				userCount:1,
				froms:"",
				reserve_msg:'预约成功',
				type:0,
				ifShow: false,
				reserve_link:'',
				size: 280, // 二维码大小
				unit: 'upx', // 单位
				background: '#ffffff', // 背景色
				foreground: '#000000', // 前景色
				pdground: '#000000', // 角标色
				icon: '', // 二维码图标
				iconsize: 40, // 二维码图标大小
				lv: 3, // 二维码容错级别 ， 一般不用设置，默认就行
				onval: false, // val值变化时自动重新生成二维码
				loadMake: true, // 组件加载完成后自动生成二维码
				src: '', // 二维码生成后的图片地址或base64
				//end
				logo_img:'http://armindiary.mashizai.com/adminApp/static/logo.jpg',
			}
		},
		computed:{
			mode(){
				return this.tabList[this.tabIndex].mode
			},
			defaultVal(){
				return this.tabList[this.tabIndex].value
			}
		},
		mounted: function () {
			if(this.reserve_id>0){
				uni.request({
					url: uni.getStorageSync('api_url')+'/reserve/info?reserve_id='+this.reserve_id,
					method: 'GET',
					header:{'content-type': 'application/x-www-form-urlencoded'},
					complete: (result) => {
						//console.log(result.data.msg);
						if(result.data.code==1){
							var rdata=result.data.msg;
							//console.log(rdata);
							this.shopId=rdata.shopId;
							this.shopName=rdata.shopName;
							this.shopPhone=rdata.shopPhone;
							this.yy_shopUserId=rdata.shopUserId;
							this.yy_shopUserName=rdata.shopUserName;
							this.adv_text=rdata.shopUserName;
							this.yy_cardId=rdata.cardId;
							this.yy_cardName=rdata.cardName;
							this.card_text=rdata.cardName;
							this.service_list=rdata.service.services;
							this.use_time=1000;
							
							//this.yy_serviceIds=rdata.yy_serviceIds;
							//this.yy_serviceTitles=rdata.yy_serviceTitles;
							this.userId=rdata.userId;
							this.reserveType=rdata.reserveType;
							this.froms=rdata.froms;
							this.from_text=rdata.froms;
							this.userName=rdata.userName!=null ? rdata.userName:"";
							this.userPhone=rdata.userPhone!=null ? rdata.userPhone:"";
							this.userCount=rdata.userCount!=null ? rdata.userCount:1;
							//this.serviceDate=rdata.serviceDate;
							//this.serviceHours=rdata.serviceHours;
						}
						
					},
				});
			}else{
				this.shopId=uni.getStorageSync("shop_id");
				this.shopName=uni.getStorageSync("shop_name");
				this.shopPhone=uni.getStorageSync("shop_phone");
				//this.getCardList();
			}
			
			
		},
		methods: {
			close(){
				openAdPopup: false;	
				this.reflash_data();
			},
			reflash_data: function() {
				if(this.reserve_id==0){
					uni.switchTab({
						url:'/pages/ucenter/ucenter'
					});
				}else{
					window.close();
				}
			    
			},
			in_array(search,array){
			    for(var i in array){
			        if(array[i]==search){
			            return true;
			        }
			    }
			    return false;
			},
			selectHour(hour){
				if(!this.in_array(hour,this.yy_serviceHours)){
					this.yy_serviceHours.push(hour);
				}else{
					this.yy_serviceHours.splice(this.yy_serviceHours.indexOf(hour),1);
				}
			},
			selectService(item){
				
				if(!this.in_array(item.id,this.yy_serviceIds)){
				
					if(this.use_time==this.yy_serviceIds.length){
						uni.showToast({
							title:'最多可以选择'+this.use_time+'个服务项目',
							icon:'none'
						});
						return false;
					}else{
						this.yy_serviceIds.push(item.id);
						this.yy_serviceTitles.push(item.title);
						this.need_time+=1;
					}
					
				}else{
					this.yy_serviceIds.splice(this.yy_serviceIds.indexOf(item.id),1);
					this.yy_serviceTitles.splice(this.yy_serviceTitles.indexOf(item.title),1);
					this.need_time-=1;
				}
			},
			
			getHasServiceHoursList(page=1,perPage=50){
				var where='&shopUserId='+this.yy_shopUserId+'&serviceDate='+this.yy_serviceDate;
				uni.request({
					url: uni.getStorageSync('api_url')+'/reserve/getHasServiceHoursList?&perPage='+perPage+'&page='+page+where,
					complete: (result) => {
						uni.hideLoading();
						if(result.data.code != 1){
							uni.showToast({
								title:result.data.msg,
								icon:'none'
							});
						}else{
							const data=result.data.data.data;
							this.has_hours=[];
							var ss="";
							data.forEach((rst) => {
								ss+=(ss!="" ? ",":"")+rst.serviceHours;	
							});
							this.has_hours=ss.split(",");
							if(this.service_hour_list.length<=this.has_hours.length && this.service_hour_list.length>0){
								uni.showToast({
									title:'该美容师当天已被全部预约，请选择其它美容师或其它日期',
									icon:'none',
									duration:2000,
								});
							}
						}
						
					},
				});
			},
			  addReserve: function() {
				  this.type=0;
					if(this.reserve_id>0){
					/*	if(this.userName==""){
							uni.showToast({
								title:'用户姓名必填',
								icon:'none'
							});
							return false;
						}
						if(this.userPhone==""){
							uni.showToast({
								title:'预约手机号必填',
								icon:'none'
							});
							return false;
						}*/
						if(parseInt(this.userCount)==0){
							uni.showToast({
								title:'预约位数必填',
								icon:'none'
							});
							return false;
						}
					}
					if(this.froms==""){
						uni.showToast({
							title:'预约类型必填',
							icon:'none'
						});
						return false;
					}
					if(parseInt(this.userCount)<=0){
						uni.showToast({
							title:'预约位数必需大于0',
							icon:'none'
						});
						return false;
					}
					if(this.yy_serviceIds.length==0){
						uni.showToast({
							title:'服务项目必填',
							icon:'none'
						});
						return false;
					}
					if(this.yy_serviceDate==""){
						uni.showToast({
							title:'预约日期必填',
							icon:'none'
						});
						return false;
					}
					if(this.yy_serviceHours.length==0){
						uni.showToast({
							title:'预约时间必填',
							icon:'none'
						});
						return false;
					}else if(this.need_time!=this.yy_serviceHours.length){
						uni.showToast({
							title:'预约时间段必须为'+this.need_time+'个',
							icon:'none'
						});
						return false;
					}
					if(this.yy_cardId==""){
						uni.showToast({
							title:'服务卡必填',
							icon:'none'
						});
						return false;
					}
					
					if(this.yy_shopUserId==""){
						uni.showToast({
							title:'美容师必填',
							icon:'none'
						});
						return false;
					}
					var aa=this.yy_serviceHours.join(",");
					uni.showLoading({
						title: '提交预约'
					});
					this.yy_serviceHours.sort();
					
					uni.request({
						url: uni.getStorageSync('api_url')+'/reserve/admin_add',
						method: 'POST',
						data: {
						reserve_id:this.reserve_id,
						shopId:this.shopId,
						shopName:this.shopName,
						shopUserId:this.yy_shopUserId,
						shopUserName:this.yy_shopUserName,
						cardId:this.yy_cardId,
						cardName:this.yy_cardName,
						serviceIds:this.yy_serviceIds.join(","),
						serviceTitles:this.yy_serviceTitles.join(","),
						userId:0,
						reserveType:2,
						froms:this.froms,
						userName:this.userName,
						userPhone:this.userPhone,
						userCount:parseInt(this.userCount),
						serviceDate:this.yy_serviceDate,
						serviceHours:this.yy_serviceHours.join(","),},
						header:{'content-type': 'application/x-www-form-urlencoded'},
						complete: (result) => {
							uni.hideLoading();
							if(result.data.code != 1){
								uni.showToast({
									title:result.data.msg,
									icon:'none'
								});
							}else{
								this.position = 'ad';
								this.openPopup = true;	
								if(this.reserve_id>0){
									this.hide_close=true;
									
								}
							}
						},
						});
			    
			  },
			addMemberReserve(){
				if(this.reserve_method==''){
					location.href=location.href+'?reserve_method=qlink';
				}
			},
			addReserveLink: function(type) {//1 link,2.二维码
				this.type=type;
				if(this.froms==""){
					uni.showToast({
						title:'预约类型必填',
						icon:'none'
					});
					return false;
				}
				
				if(this.yy_cardId==""){
					uni.showToast({
						title:'服务卡必填',
						icon:'none'
					});
					return false;
				}
				
				if(this.yy_shopUserId==""){
					uni.showToast({
						title:'美容师必填',
						icon:'none'
					});
					return false;
				}
				var aa=this.yy_serviceHours.join(",");
				uni.showLoading({
					title: '提交预约'
				});
				
				uni.request({
					url: uni.getStorageSync('api_url')+'/reserve/admin_add',
					method: 'POST',
					data: {
					shopId:this.shopId,
					shopName:this.shopName,
					shopUserId:this.yy_shopUserId,
					shopUserName:this.yy_shopUserName,
					cardId:this.yy_cardId,
					cardName:this.yy_cardName,
					serviceIds:this.yy_serviceIds.join(","),
					serviceTitles:this.yy_serviceTitles.join(","),
					userId:0,
					reserveType:2,
					froms:this.froms,
					userName:this.userName,
					userPhone:this.userPhone,
					userCount:this.userCount,
					serviceDate:this.yy_serviceDate,
					serviceHours:this.yy_serviceHours.join(","),},
					header:{'content-type': 'application/x-www-form-urlencoded'},
					complete: (result) => {
						uni.hideLoading();
						if(result.data.code != 1){
							uni.showToast({
								title:result.data.msg,
								icon:'none'
							});
						}else{
							if(this.type>0){
								this.reserve_link='http://armindiary.mashizai.com/adminApp/#/pages/home/reservation_list/reservation_add?shop_id='+this.shopId+'&reserve_id='+result.data.msg.id;
								if(this.type==2){
									this.ifShow=true;
								}
								var _this=this;
								this.wxshare(_this);
								
							}else{
								this.position = 'ad';
								this.openPopup = true;
							}
							
							
						}
					},
				});
			
			},
			
			toggleTab(index){
				this.tabIndex=index;
				this.$refs.picker.show();
			},
			onConfirm(val){
				
				console.log(val);
				var curTime = new Date();
				var newhours=curTime.setHours(curTime.getHours() + 2);
				var cur_day=(new Date()).Format("yyyy-MM-dd");
				this.service_hour_list=[];
					var canset=(new Date(newhours)).Format("yyyy-MM-dd");//默认今天
				if(curTime.getHours()>20){//明天
					uni.showToast({
						title:'预约至少提前2小时',
						icon:'none'
					});
					newhours=curTime.setDate(curTime.getDate()+1);
					newhours=curTime.setHours(8);
					canset=(new Date(newhours)).Format("yyyy-MM-dd");
					this.service_hour_list=this.service_hour_list_old;
				}else if(cur_day==val.result){//今天
					for(var i in this.service_hour_list_old){
						console.log(this.service_hour_list_old[i].name+','+curTime.getHours());
						if(curTime.getHours()<=this.service_hour_list_old[i].id){
							this.service_hour_list.push(this.service_hour_list_old[i]);
						}
					}	
				}else if(cur_day>val.result){//今天
					uni.showToast({
						title:'预约至少提前2小时',
						icon:'none'
					});
					//newhours=curTime.setDate(curTime.getDate()+1);
					for(var i in this.service_hour_list_old){
						console.log(this.service_hour_list_old[i].name+','+curTime.getHours());
						if(curTime.getHours()<=this.service_hour_list_old[i].id){
							this.service_hour_list.push(this.service_hour_list_old[i]);
						}
					}
				}else{//指定天
					canset=val.result;
					this.service_hour_list=this.service_hour_list_old;
				}				
				this.yy_serviceDate=canset;
				this.getHasServiceHoursList();	
			},
			fromAs () {
				const from_list_data=[];
				this.from_list.forEach((rst) => {
					from_list_data.push({"id":rst,"name":rst});	
				});
			  this.$refs.as3.handleShow({
			    actions: from_list_data,
			    success: (res) => {
			      if (res.id!="" && res.id!=this.froms){
						this.from_text=res.data.name;
						this.froms=res.id;
						this.card_text="未选择";
						this.yy_cardId=0;
						this.yy_cardName="";
						this.service_list=[];
						this.getCardList();
					 }else if(res.id==""){
						this.from_text= "未选择";
						this.froms="";
					 } 
			    }
			  })
			},
			cardAs () {
				const card_list_data=[];
				this.card_list.forEach((rst) => {
					card_list_data.push({"id":rst.adId,"smcCanUseNum":10000,"name":rst.adTitle,"services":rst.services});	
				});
			  this.$refs.as2.handleShow({
			    actions: card_list_data,
			    success: (res) => {
			      if (res.id < 0) {
						this.card_text="未选择";
						this.yy_cardId=0;
						this.service_list=[];
					 } else { 
						this.card_text=res.data.name;
						this.yy_cardId=res.id;
						this.service_list=res.data.services;
						this.use_time=res.data.smcCanUseNum;
						this.yy_cardName=res.data.name;
						
					 } 
			    }
			  })
			},
			
			adviserAs () {
				const shop_user_data=[];
				this.shop_user_list.forEach((rst) => {
					shop_user_data.push({"id":rst.id,"name":rst.name});	
				});
			  this.$refs.as1.handleShow({
			    actions:shop_user_data,
			    success: (res) => {
					//console.log(res);			     				  
				  if (res.id < 0) {
						this.adv_text="未选择";
						this.yy_shopUserId="";
						this.yy_shopUserName="";
					 } else {
						this.adv_text=res.data.name
						this.yy_shopUserId=res.id;
						this.yy_shopUserName=res.data.name;
						this.getHasServiceHoursList();	
					 } 
			    }
			  })
			},
			coplink(){
				uni.setClipboardData({ data:this.reserve_link, success:function(data){uni.showToast({
						title:'复制成功',
						icon:'none'
					});}, fail:function(err){}, complete:function(res){} })
			},
			wxshare(_this){
				uni.request({
				url: uni.getStorageSync('api_url2')+'/wechat/wxjs',
				data: {url:_this.reserve_link},
				method:'POST',
				header:{'content-type': 'application/x-www-form-urlencoded'},
				success: (result) => {
					if (result.statusCode == 200) {
						var datas=result.data.data;
						jweixin.config({
							debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
							appId: datas.appId, // 必填，公众号的唯一标识
							timestamp: datas.timestamp, // 必填，生成签名的时间戳
							nonceStr: datas.nonceStr, // 必填，生成签名的随机串
							signature: datas.signature,// 必填，签名
							jsApiList: datas.jsApiList // 必填，需要使用的JS接口列表
						});
						jweixin.ready(function () {   //需在用户可能点击分享按钮前就先调用
							jweixin.updateAppMessageShareData({ 
								title:_this.yy_shopUserName +"邀请您参加预约" , // 分享标题
								desc: _this.yy_shopUserName +"邀请您参加预约",//product.goods_brief, // 分享描述
								link: _this.reserve_link,//datas.url, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
								imgUrl:_this.logo_img , // 分享图标
								success: function () {
								  
								}
							});
							jweixin.updateTimelineShareData({ 
								title:_this.yy_shopUserName +"邀请您参加预约" , // 分享标题
								link: _this.reserve_link,//datas.url, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
								imgUrl:_this.logo_img , // 分享图标
								success: function () {
								  
								}
							});
							
						});
						
					}
				},
				});
			},
			getCardList(page=1,perPage=50){
				
				var where='&shopId='+this.shopId+'&adType='+this.froms;
				uni.request({
					url: uni.getStorageSync('api_url')+'/reserve/getActivityList?&perPage='+perPage+'&page='+page+where,
					complete: (result) => {
						uni.hideLoading();
						if(result.data.code != 1){
							uni.showToast({
								title:result.data.msg,
								icon:'none'
							});
						}else{
							const data=result.data.data.data;
							this.card_list=[];
							data.forEach((rst) => {
							this.card_list.push(rst);	
							});
							if(this.card_list.length==0){
								uni.showModal({
								    title: '提示',
								    content: '暂时没有活动预约，请前往管理后台添加活动后再试。',
								    success: function (res) {
								       uni.switchTab({
								       url:'/pages/ucenter/ucenter'
								       });
								    }
								});
							}
						}
						
					},
				});
			},
		}
	}
</script>

<style>
	 .userbox,button{
	text-align: left;
	 line-height: 42px;
	background-color: #FFFFFF;
	font-size: 15px;
	border-radius: 5px;
	margin-bottom: 1rem;
	padding-left:0px;
	}
	.userbox{display: inline-block;width: 100%;}
	.userbox .van-cell_value{float: left;width: 55%;
    line-height: 42px;}
	.userbox .van-cell_value input{line-height: 42px;height: 42px;padding: 0;margin: 0;}
	.van-cell_title{float: left; padding-right: 15px;}
	.servicebox{width: 100%;display: inline-block;}
	.no-data{text-align: center;
    padding: 5px;
    color: #ccc;
	font-size: 14px;
	margin-bottom: 1rem;
    display: block;}
	.s_hour{
		background: #fff;
		border: 1px solid #ccc;
		padding: 0px;
		font-size: 13px;
		line-height: 15px;
		margin: 1%;
		float: left;
		width: 47%;
		border-radius: 5px;
		display: block;
		text-align: center;
		min-height: 40px;
		display: table;
	}
	.s_hour span{
	    display: table-cell !important;
	    vertical-align: middle !important;
	}
	.disabled{background: #aaa;}
	.selected{background: #6d1c79;color: #fff;}
	.location-icon{
	width: 1rem;
	height: 1rem;
	float: left;
	margin: 0.6rem;
	}
	.right{
	float: right;
		}
	.appointment{
       width: 45%;
       float: left;
       margin: 3% 2%;
    text-align: center;
	background: #6d1c79;
	padding-right: 0px;
	color: #FFFFFF;
	}
	.qr-code{display: inline-block;clear: both;margin-top: 15px;width: 100%;    text-align: center;}
	.disd{color:#aaa !important;}
</style>
